package com.sbl.bajw.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class DateUtil {

	static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	
	public static String getMondayDate(){
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
		String date = sdf.format(cal.getTime());
		return date;
	}
	
	public static String getSundayDate(){
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
		cal.add(Calendar.WEEK_OF_YEAR, 1);
		String date = sdf.format(cal.getTime());
		return date;
	}
	
	public static String getTodayDate(){
		Calendar cal = new GregorianCalendar();
		cal.setTime(new Date());
		String date = sdf.format(cal.getTime());
		return date;
	}
	
	public static String getYesterdayDate(){
		Calendar cal = new GregorianCalendar();
		cal.setTime(new Date());
		cal.add(Calendar.DATE, -1);
		String date = sdf.format(cal.getTime());
		return date;
	}
}
